Improve FIPS error diagnostics#207
Merged
rlm2002 merged 3 commits intowolfSSL:masterfrom Apr 1, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves FIPS failure diagnostics in the wolfJCE provider and makes threaded MessageDigest tests more robust when FIPS-related failures occur.
Changes:
- Add a default wolfCrypt FIPS error callback in
WolfCryptProviderthat logs diagnostic details. - Enrich
WolfCryptExceptionmessages forFIPS_NOT_ALLOWED_Eby appending the underlying FIPS module status when available. - Adjust multiple threaded MessageDigest tests to avoid indefinite hangs when thread setup fails.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java | Registers a default FIPS error callback and logs FIPS errors for diagnostics. |
| src/main/java/com/wolfssl/wolfcrypt/WolfCryptException.java | Builds a richer error message for FIPS_NOT_ALLOWED_E by querying module status. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestShaTest.java | Adds latch countdown on MessageDigest instantiation failure in threaded test. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha256Test.java | Adds latch countdown on MessageDigest instantiation failure in threaded test. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha384Test.java | Adds latch countdown on MessageDigest instantiation failure in threaded test. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha512Test.java | Adds latch countdown on MessageDigest instantiation failure in threaded test. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha3Test.java | Adds latch countdown on MessageDigest instantiation failure in threaded test. |
| src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestMd5Test.java | Adds latch countdown on MessageDigest instantiation failure in threaded test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add latch.countDown() and return in catch block to prevent thread from falling through to null MessageDigest reference.
rlm2002
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WolfCryptProviderthat logs the error code, description, and verifyCore hash to stderr on first occurrence of each unique error. Suppresses duplicate messages. If wolfJSSE is also registered, the last provider instantiated has its callback active (both provide equivalent logging).WolfCryptExceptionforFIPS_NOT_ALLOWED_Eerrors by queryingwolfCrypt_GetStatus_fips()and appending the underlying module status (e.g., DRBG continuous test failure, integrity check failure) to the exception message.latch.countDown().